Package-level declarations

Contains types such as NotEmptyList for manipulating collections.

Types

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
interface NotEmptyCollection<out E>

Representation of collections containing at least one element of type E.

Link copied to clipboard
@Serializable(with = NotEmptyListSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptyList<out E> : NotEmptyCollection<E>

Representation of lists that contain at least one element of type E.

Link copied to clipboard
@Serializable(with = NotEmptyMapSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptyMap<K, out V>

Representation of maps that contain at least one entry with a key of type K and a value of type V.

Link copied to clipboard
@Serializable(with = NotEmptySetSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptySet<out E> : NotEmptyCollection<E>

Representation of sets that contain at least one element of type E.

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> notEmptyListOf(head: E, vararg tail: E): NotEmptyList<E>

Creates a NotEmptyList starting with a head and containing all the elements of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <K, V> notEmptyMapOf(head: Pair<K, V>, vararg tail: Pair<K, V>): NotEmptyMap<K, V>

Creates a NotEmptyMap starting with a head and containing all the entries of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> notEmptySetOf(head: E, vararg tail: E): NotEmptySet<E>

Creates a NotEmptySet starting with a head and containing all the elements of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> Collection<E>.toNotEmptyList(): Result<NotEmptyList<E>>

Returns an encapsulated NotEmptyList containing all the elements of this collection, or returns an encapsulated IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <K, V> Map<K, V>.toNotEmptyMap(): Result<NotEmptyMap<K, V>>

Returns an encapsulated NotEmptyMap containing all the entries of this map, or returns an encapsulated IllegalArgumentException if this map is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> Collection<E>.toNotEmptySet(): Result<NotEmptySet<E>>

Returns an encapsulated NotEmptySet containing all the elements of this collection, or returns an encapsulated IllegalArgumentException if this collection is empty.

Properties

Link copied to clipboard
@SinceKotoolsTypes(version = "4.1")
val NotEmptyCollection<*>?.sizeOrZero: PositiveInt

Returns the size of this collection, or returns ZeroInt if this collection is null.